﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LeftFork.TestHelpers;

namespace LeftFork.TestHelpersTests {

    [TestClass]
    public class ExtensionsTests {

        [TestMethod]
        public void should_should_should() {
            var sut = new MyObject();
            sut
                .with(t => t.Prop1 = "test")
                .Process()
                .should()
                .equal("test ex");

            sut
                .with(t => t.Prop1 = "jon")
                .Process()
                .should()
                .equal("jon ex");

            sut.should().be_instance_of<MyObject>();

            "test".should().equal("test");
            "test".should().not().equal("not");

            sut = null;
            sut.should().be_null();


        }


        [TestMethod]
        public void numbers_should_add_correctly_old() {
            int val1 = 2;
            int val2 = 2;
            int result = val1.plus(val2);
            int expected = 4;
            Assert.AreEqual(expected, result, string.Format("Numbers {0} and {1} did not add correctly", val1, val2));
        }

        [TestMethod]
        public void numbers_should_add_correctly_new() {
            2.plus(2).should().equal(4);     
        }
    }

    class MyObject {
        public string Prop1 { get; set; }
        public string Process() {
            return Prop1 + " ex";
        }

        
    }

    public static class Extensions {
        public static int plus(this int src, int add) {
            return src + add;
        }
    }
}
